package com.dao;

import com.entity.*;
import com.utils.PropertiesUtils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

import java.sql.SQLException;

public class adminDao {

    public admin login(admin userman) throws SQLException {
        QueryRunner queryRunner = new QueryRunner(PropertiesUtils.getDataSource());
        String sql = "select * from adminlogin where username = ? and password = ?";
        admin entity = queryRunner.query(sql, new BeanHandler<>(admin.class), userman.getUsername(), userman.getPassword());
        return entity;
    }
}
